package com.geekhalo.domainevent.v3.transaction;

import com.geekhalo.domainevent.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;

@Service
public class TransactionalRecommendListener {

    @Autowired
    private RecommendService recommendService;

    @TransactionalEventListener
    public void recalculateRecommend(OrderCreatedEvent event){
        RecalculateRecommendCommand recalculateRecommendCommand = buildRecalculateRecommendCommand...
        this.recommendService.recalculate(recalculateRecommendCommand);
    }
}
